//
//  BKColleageViewController.m
//  baokaodaxue
//
//  Created by dangyangyang on 15/6/2.
//  Copyright (c) 2015年 宏图教育. All rights reserved.
//

#import "BKColleageViewController.h"
#import "BKJianJieViewController.h"
#import "BKXueKeViewController.h"
#import "BKZhaoShengViewController.h"
#import "BKHuanJingViewController.h"

@interface BKColleageViewController ()<tabbarViewControllerDelegate>

@end

@implementation BKColleageViewController

- (void)dismiss{

    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
   
    
}


- (void)setCid:(NSString *)cid{

    _cid = cid;
    BKJianJieViewController *jianjie = [[BKJianJieViewController alloc] initWithNibName:NSStringFromClass([BKJianJieViewController class]) bundle:nil];
    jianjie.delegate = self;
    jianjie.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"简介" image:nil tag:9000];
    jianjie.name = _name;
    jianjie.cid = _cid;
    
    
    BKXueKeViewController *xueke = [[BKXueKeViewController alloc] initWithNibName:NSStringFromClass([BKXueKeViewController class]) bundle:nil];
    xueke.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"学科" image:nil tag:9001];
    xueke.delegate = self;
    xueke.cid = _cid;
    xueke.name = _name;
    
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSString *proText = [defaults objectForKey:@"province_pro_text"];
    BKZhaoShengViewController *zhaosheng = [[BKZhaoShengViewController alloc] initWithNibName:NSStringFromClass([BKZhaoShengViewController class]) bundle:nil];
    zhaosheng.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"招生" image:nil tag:9002];
    zhaosheng.cid = _cid;
    zhaosheng.delegate = self;
    zhaosheng.name = _name;
    zhaosheng.pro = proText;
    
    BKHuanJingViewController *huanjing = [[BKHuanJingViewController alloc] initWithNibName:NSStringFromClass([BKHuanJingViewController class]) bundle:nil];
    huanjing.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"环境" image:nil tag:9001];
    huanjing.name = _name;
    huanjing.cid = _cid;
    huanjing.delegate = self;
    NSArray *array = @[jianjie,zhaosheng,xueke,huanjing];
    self.viewControllers = array;
     [self setTabBarViewController];
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
- (void)setTabBarViewController{
    
    
    
    NSDictionary *textColorDic = [NSDictionary dictionaryWithObjectsAndKeys:
                                  [UIColor whiteColor],
                                  NSForegroundColorAttributeName,
                                  [UIFont fontWithName:@"DFPWAWAW5-GB" size:14],NSFontAttributeName,nil];
    

    UITabBarController *tabBarViewController = self;
 [tabBarViewController.tabBar setBarTintColor:[UIColor colorWithRed:0.439 green:0.808 blue:0.827 alpha:1.000]];
   
    
    NSArray *tabBarArray = tabBarViewController.tabBar.items;
    UITabBarItem *searchTabBarItem = (UITabBarItem *)tabBarArray[0];
    [searchTabBarItem setImage:[[UIImage imageNamed:@"app简介按钮"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    [searchTabBarItem setSelectedImage:[[UIImage imageNamed:@"app简介按钮"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    
    [searchTabBarItem setTitleTextAttributes:textColorDic forState:UIControlStateSelected];
    [searchTabBarItem setTitleTextAttributes:textColorDic forState:UIControlStateNormal];
    
    UITabBarItem *interActTabBarItem = (UITabBarItem *)tabBarArray[1];
    [interActTabBarItem setImage:[[UIImage imageNamed:@"招生按钮"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    [interActTabBarItem setSelectedImage:[[UIImage imageNamed:@"招生按钮"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    [interActTabBarItem setTitleTextAttributes:textColorDic forState:UIControlStateNormal];
    [interActTabBarItem setTitleTextAttributes:textColorDic forState:UIControlStateSelected];
    
    UITabBarItem *newsTabBarItem = (UITabBarItem *)tabBarArray[2];
    [newsTabBarItem setImage:[[UIImage imageNamed:@"专业按钮"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    [newsTabBarItem setSelectedImage:[[UIImage imageNamed:@"专业按钮"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    [newsTabBarItem setTitleTextAttributes:textColorDic forState:UIControlStateNormal];
    [newsTabBarItem setTitleTextAttributes:textColorDic forState:UIControlStateSelected];
    
    
    UITabBarItem *meTabBarItem = (UITabBarItem *)tabBarArray[3];
    [meTabBarItem setImage:[[UIImage imageNamed:@"环境按钮"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    [meTabBarItem setSelectedImage:[[UIImage imageNamed:@"环境按钮"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    [meTabBarItem setTitleTextAttributes:textColorDic forState:UIControlStateNormal];
    [meTabBarItem setTitleTextAttributes:textColorDic forState:UIControlStateSelected];
    
    
}
@end
